package com.czp.mall.zuul.filter;

import javax.servlet.http.HttpServletRequest;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;

public class PreZuulFilter extends ZuulFilter{

	@Override
	public boolean shouldFilter() {
		// TODO 是否启用此过滤器
		return true;
	}

	@Override
	public Object run() throws ZuulException {
		HttpServletRequest request = RequestContext.getCurrentContext().getRequest();
		String remoteHost = request.getRemoteHost();
		System.out.println("请求的host：" + remoteHost);
		return null;
	}

	@Override
	public String filterType() {
		// TODO 过滤器类型
		return "pre";
	}

	@Override
	public int filterOrder() {
		// TODO 过滤器的顺序，数字越大越靠后
		return 0;
	}

}
